import numpy as np
import pandas as pd

df1 = pd.read_excel('/home/thseus/workspaces/python/test.xlsx')
df2 = pd.read_excel('/home/thseus/workspaces/python/test1.xlsx')

#其实在Pandas中一行代码就能找到两个DataFrame的不同
difference = df1[df1 != df2]
print(difference)

comparison_values = df1.values == df2.values
print(comparison_values)

rows, cols = np.where(comparison_values == False)
for item in zip(rows, cols):
    df1.iloc[item[0], item[1]] = '{} --> {}'.format(df1.iloc[item[0], item[1]],
                                                    df2.iloc[item[0], item[1]])
df1.to_excel('diff.xlsx', index=False, header=True)
